<template>
  <view>
    <view class="status-bar" />
    <view class="main-container">
      <wk-nav-bar title="设置" />
				
      <view>
        <uni-section title="其他" type="line">
          <uni-list>
            <uni-list-item
              show-arrow
              :thumb="$static('images/message/announce.png')"
              thumb-size="sm" title="退出登录"
              :clickable="true"
              @click="handleClick()" />
          </uni-list>
        </uni-section>
      </view>
    </view>
  </view>
</template>

<script>
  import {logout } from 'API/login'
  export default {
    name: 'Setting',
    // components: {
    //   uniList
    // },
    data() {
      return {
        showList: true
      }
    },
    created() {
    },
    mounted() {
    },
    methods: {
      handleClick() {
        let that = this;
        uni.showModal({
          title: '退出登录',
          content: '您确定要退出登录吗',
          success: function(r) {
            if (r.confirm) {
              logout().then((res, err) => {
                console.log('res', res)
                that.$clearStorage()
                that.$toast(res.data.msg)
                setTimeout(() => {
                  uni.reLaunch({url: '/pages/login/index'})
                }, 500)
              })
            } else if (r.cancel) {
              // console.log('用户点击取消');
            }
          }
        });
      }
    }
  }
</script>

<style>

</style>
